<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<html>
<head>
    <meta charset="utf-8">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <title>在线支付</title>
<script>
    $(function(){
        $("#btn1").click(function(){
            $.ajax({
                url:"${pageContext.request.contextPath}/wxPay?method=wxQueryOrder&oid=${oid}",
                type:"GET",
                // dataType:"json",
                success:function(data){
                    if(data == 1 ){
                        // 微信支付成功
                        alert("订单支付成功，进行跳转");
                        window.location.href="http://localhost:8080/order?method=success&oid=${oid}&result=SUCCESS";
                    }else{
                        alert("订单尚未支付成功，请稍后再试");
                    }

                },
                error:function(){
                    alert("失败");
                }
            })
        });
    });
</script>
</head>
<%@ include file="header.jsp" %>
<body>
<div class="container">
    <div class="text-center">
        <h3>请使用微信扫码支付</h3>
        <img src="${pageContext.request.contextPath}/wxPay?method=getQrCode&oid=${oid}" alt="请使用微信扫码支付" class="img-thumbnail">
        <br />
        <button id="btn1" type="button" class="btn btn-primary">支付完成</button>
    </div>

</div>
<!-- 底部 -->
<%@ include file="footer.jsp"%>


</body>
</html>